/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jjsoft.disco.gco.mdl;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Johnny
 */
@Entity
@Table(catalog = "discodb", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Detallefactura.findAll", query = "SELECT d FROM Detallefactura d"),
    @NamedQuery(name = "Detallefactura.findByIddetalleFactura", query = "SELECT d FROM Detallefactura d WHERE d.iddetalleFactura = :iddetalleFactura"),
    @NamedQuery(name = "Detallefactura.findByCantidad", query = "SELECT d FROM Detallefactura d WHERE d.cantidad = :cantidad"),
    @NamedQuery(name = "Detallefactura.findByIva", query = "SELECT d FROM Detallefactura d WHERE d.iva = :iva"),
    @NamedQuery(name = "Detallefactura.findByPrecioVenta", query = "SELECT d FROM Detallefactura d WHERE d.precioVenta = :precioVenta"),
    @NamedQuery(name = "Detallefactura.findByBarra", query = "SELECT d FROM Detallefactura d WHERE d.barra = :barra")})
public class Detallefactura implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(nullable = false)
    private Integer iddetalleFactura;
    private Integer cantidad;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Column(precision = 22)
    private Double iva;
    @Column(precision = 22)
    private Double precioVenta;
    private Integer barra;
    @JoinColumn(name = "numero", referencedColumnName = "numero")
    @ManyToOne
    private Factura numero;
    @JoinColumn(name = "idArticulo", referencedColumnName = "idProductos")
    @ManyToOne
    private Producto idArticulo;
    @Transient
    private Date fecha;
    public Detallefactura() {
    }

    public Detallefactura(Integer iddetalleFactura) {
        this.iddetalleFactura = iddetalleFactura;
    }

    public Integer getIddetalleFactura() {
        return iddetalleFactura;
    }

    public void setIddetalleFactura(Integer iddetalleFactura) {
        this.iddetalleFactura = iddetalleFactura;
    }

    public Integer getCantidad() {
        return cantidad;
    }

    public void setCantidad(Integer cantidad) {
        this.cantidad = cantidad;
    }

    public Double getIva() {
        return iva;
    }

    public void setIva(Double iva) {
        this.iva = iva;
    }

    public Double getPrecioVenta() {
        return precioVenta;
    }

    public void setPrecioVenta(Double precioVenta) {
        this.precioVenta = precioVenta;
    }

    public Integer getBarra() {
        return barra;
    }

    public void setBarra(Integer barra) {
        this.barra = barra;
    }

    public Factura getNumero() {
        return numero;
    }

    public void setNumero(Factura numero) {
        this.numero = numero;
    }

    public Producto getIdArticulo() {
        return idArticulo;
    }

    public void setIdArticulo(Producto idArticulo) {
        this.idArticulo = idArticulo;
    }

    public Date getFecha() {
        return fecha;
    }

    public void setFecha(Date fecha) {
        this.fecha = fecha;
    }
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (iddetalleFactura != null ? iddetalleFactura.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Detallefactura)) {
            return false;
        }
        Detallefactura other = (Detallefactura) object;
        if ((this.iddetalleFactura == null && other.iddetalleFactura != null) || (this.iddetalleFactura != null && !this.iddetalleFactura.equals(other.iddetalleFactura))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.jjsoft.disco.gco.mdl.Detallefactura[ iddetalleFactura=" + iddetalleFactura + " ]";
    }
    
}
